from typing import List
# class Solution:
#     """
#     超时
#     """
#     def numTimesAllBlue(self, light: List[int]) -> int:
#         res = 0
#         tmp = [0] * len(light)

#         def check_light(tmp):
#             sign = True
#             for i in range(len(tmp)):
#                 if sign and tmp[i] == 1:
#                     tmp[i] = 2
#                 elif tmp[i] == 0:
#                     sign = False
#                 if not sign and tmp[i] == 1:
#                     return False
#             else:
#                 return True
#             return False
            
                
#         for i in light:
#             tmp[i-1] = 1
#             if check_light(tmp):
#                 res += 1

#         return res

# class Solution:
#     """
#     超时
#     """
#     def numTimesAllBlue(self, light: List[int]) -> int:
#         res = 0
#         tmp = "0" * len(light)
#         for v in light:
#             tmp = tmp[:v-1] + "1" + tmp[v:]

#             if "01" in tmp:
#                 res += 1
#         print('....',res)
#         return len(light) - res

class Solution:
    """
    超时
    """
    def numTimesAllBlue(self, light: List[int]) -> int:
        tmp = [0] * len(light)
        for v in light:
            tmp[v-1] = 1

            


if __name__ == "__main__":
    # print(Solution().numTimesAllBlue([2,1,3,5,4]))
    print(Solution().numTimesAllBlue([1,2,3,4,5]))